(function () {
    const nknamepic = document.querySelector('.nknamepic');
    const imgpic = document.querySelector('.imgpic');
    const petname = document.querySelector('.pet-name');

    //获取当前用户信息
    axios.get('/api/user').then(function (res) {
        const data = res.data.userinfo;
        console.log(data);
        if (data.avater) {
            nknamepic.src = data.avater;
            imgpic.src = data.avater;
            petname.innerHTML = '克施勤德';
        } else {
            // window.location.href = './index.html';
        }
    }).catch(function (error) {
        console.log(error);
    });


    let logout = document.querySelector('.logout');
    logout && logout.addEventListener('click', function () {
        sessionStorage.removeItem('tel');
        sessionStorage.removeItem('regtel');
        show.style.display = 'none';
        leave.style.display = 'inline-block';
    })

}
)();
